package vn.nt.healthcare.server.ws.repositories;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import vn.nt.healthcare.server.ws.domain.User;

public interface UserRepository extends JpaRepository<User, String> {

	User findByUuidAndPassword(String uuid, String password);

	@Query("SELECT DISTINCT u FROM User u WHERE u.username = ?1 AND u.password = ?2")
	User findUserByUsernameAndPassword(String username, String password);

	@Query("SELECT DISTINCT u FROM User u WHERE u.username = :username")
	User isExistedUser(@Param("username") String username);
}
